package priv.gitonline.flowable.ui;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.util.LinkedHashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) throws  Exception{
        DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
        DocumentBuilder db=dbf.newDocumentBuilder();
        Document doc=db.newDocument();
        //definitions
        Element definitions=doc.createElement("definitions");
        Map<String,String> definitionsAttrsMap=new LinkedHashMap();
        definitionsAttrsMap.put("xmlns","http://www.omg.org/spec/BPMN/20100524/MODEL");
        definitionsAttrsMap.put("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
        definitionsAttrsMap.put("xmlns:xsd","http://www.w3.org/2001/XMLSchema");
        definitionsAttrsMap.put("xmlns:flowable","http://flowable.org/bpmn");
        definitionsAttrsMap.put("xmlns:bpmndi","http://www.omg.org/spec/BPMN/20100524/DI");
        definitionsAttrsMap.put("xmlns:omgdc","http://www.omg.org/spec/DD/20100524/DC");
        definitionsAttrsMap.put("xmlns:omgdi","http://www.omg.org/spec/DD/20100524/DI");
        definitionsAttrsMap.put("typeLanguage","http://www.w3.org/2001/XMLSchema");
        definitionsAttrsMap.put("expressionLanguage","http://www.w3.org/1999/XPath");
        definitionsAttrsMap.put("targetNamespace","http://www.flowable.org/processdef");
        definitionsAttrsMap.forEach((key,value)->{
            definitions.setAttribute(key,value);
        });

        Element process=doc.createElement("process");
        definitions.appendChild(process);




    }
}
